package ch.hslu;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class CustomerTest {

	Customer testee;

	@Before
	public void setUpTestee() throws Exception {
		testee = new Customer("Hans Muster");
		Movie tribute = new Movie("Tribute von Panem", 2.30);
		Movie hangover = new Movie("Hangover the Movie", 1.20);
		Movie wk = new Movie("Achtung fertig WK!", 3.40);
		Rental r1 = new Rental(tribute, 1);
		Rental r2 = new Rental(hangover, 2);
		Rental r3 = new Rental(wk, 3);
		testee.addRental(r1);
		testee.addRental(r2);
		testee.addRental(r3);
	}

	@Test
	public void testStatement() {
		String text = testee.statement();
		System.out.println(text);
		String expectedText = "Rental Record for Hans Muster\n"
				+ " Tribute von Panem 2.3\n"//
				+ " Hangover the Movie 2.4\n"//
				+ " Achtung fertig WK! 10.2\n"//
				+ "Amount owed is 14.899999999999999\n"//
				+ "You earned 6 frequent renter points";
		assertEquals(expectedText, text);
	}

	@Test
	public void testHtmlStatement() {
		String text = testee.htmlStatement();
		System.out.println(text);
		String expectedText = "<H1>Rentals for <EM>Hans Muster</EM></H1>\n"
				+ "Tribute von Panem: 2.3<BR>\n"//
				+ "Hangover the Movie: 2.4<BR>\n"//
				+ "Achtung fertig WK!: 10.2<BR>\n"//
				+ "You owe <EM>14.899999999999999</EM>\n"//
				+ "On this rental you earned <EM>6</EM> frequent renter points";
		assertEquals(expectedText, text);
	}

}
